<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// 登陆退出
Route::get('/login', 'LoginController@create')->name('login');
Route::post('/login', 'LoginController@store')->name('login');
Route::delete('/logout', 'LoginController@destroy')->name('logout');
// 忘记密码
Route::get('/forget', 'LoginController@forgetcreate')->name('forgetpassword');
Route::post('/forget', 'LoginController@forgetstore')->name('forgetpassword');

Route::group(['middleware' => ['auth']], function () {
    Route::get('/', 'AdminController@index')->name('home');
    Route::get('/main', 'AdminController@main')->name('main');
    // 用户相关路由
    Route::resource('users', 'UsersController');
    Route::get('users/{user}/editrole', 'UsersController@editrole')->name('users.editrole');
    Route::put('users/{user}/updaterole', 'UsersController@updaterole')->name('users.updaterole');
    // 角色相关路由
    Route::resource('roles', 'RolesController');
    Route::get('roles/{role}/editpermission', 'RolesController@editpermission')->name('roles.editpermission');
    Route::put('roles/{role}/updatepermission', 'RolesController@updatepermission')->name('roles.updatepermission');
    // 权限节点相关路由
    Route::resource('permissions', 'PermissionsController');
    Route::get('batchcreate', 'PermissionsController@batchcreate')->name('permissions.batchcreate');
    Route::post('batchstore', 'PermissionsController@batchstore')->name('permissions.batchstore');
});